import request from '@/utils/request.js'

// 登录注册
export const login = data => {
  return request({
    method: 'POST',
    url: '/v1_0/authorizations',
    data
  })
}

// 发送验证码
export const code = mobile => {
  return request({
    url: '/v1_0/sms/codes/' + mobile
  })
}

// 获取用户个人资料
export const user = () => {
  return request({
    url: '/v1_0/user'
  })
}

// 关注用户
export const addFollowed = (data) => {
  return request({
    url: '/v1_0/user/followings',
    method: 'post',
    data
  })
}

// 取消关注的用户
export const delFollowed = (target) => {
  return request({
    url: `/v1_0/user/followings/${target}`,
    method: 'DELETE'
  })
}
